<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/6/8
  Time: 16:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
    <script type="text/javascript">
        function  login() {
            var msg = "${msg}";
            if(msg.length>0){
                alert("账号或密码错误");
            }
        }
    </script>
</head>
<body onload="login()">
    <form action="/login.controller" method="post">
        <p>用户名:<input type="button" value="登录" id="login"> </p>
        <select id="users">
        </select>
    </form>
    <script type="text/javascript">
        $("#login").click(function () {
            $.ajax({
                url:"/list.controller",
                success:function (result) {
                    $("#users").empty();
                    $.each(result,function (index,itmes) {
                        $("#users").append("<option value="+itmes.userid+">"+itmes.username+"</option>");
                    })
                },
                error:function () {
                    alert("错误");
                }
            })
        });
    </script>
</body>
</html>
